Skip to content

[eas-cli] Keep simulator control connections alive - #4791

Merged
gwdp merged 1 commit into
mainfrom
gwdp/simulator-control-keep-alive
Nov 5, 2026
Merged

gwdp merged 1 commit into
mainfrom
gwdp/simulator-control-keep-alive

Conversation

@gwdp

@gwdp gwdp commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Why

Repeated control commands reconnect to the preview server. Let agents keep the connection ready between commands.

How

Add an optional local helper and share action preparation, uploads, downloads and execution. Ordinary control commands reuse the helper when available. The idle timeout defaults to 120 seconds.

eas simulator:control:connection open --idle-timeout 300
eas simulator:control appearance.set dark
eas simulator:control:connection status --id <session-id> --json
eas simulator:control:connection close

# Or keep the connection after an action:
eas simulator:control hardwareKeyboard.set off --keep-alive --idle-timeout 30

--idle-timeout takes seconds. Closing the connection leaves the simulator session running. Keep-alive supports macOS and Linux; ordinary commands still work on Windows. Control import (#4686) and start import (#4687) use this shared executor.

Security and cleanup

The helper uses an owned, private Unix socket directory. Processes running as the same OS user share this authority. Discovery is scoped to EAS credentials, project, session, API environment and CLI installation/version. Preview credentials pass over parent-child IPC; no new credential file is written.

Callers run one at a time. A dropped reply never triggers an automatic replay. Messages, queues and waits are bounded. Close finishes the in-flight action, rejects later actions and permits bounded upload cleanup. Immediate reopen waits for the drain.

Saved-login changes, idle expiry and remote disconnect close the helper. Server-side access-token revocation is not polled. An already-dispatched action can finish during shutdown.

Test Plan

Codex ran 1,020 account, simulator and help tests, a clean build and typecheck on the rebased full stack. Scoped lint and formatting pass. Each feature patch is unchanged by the main-only rebase. Devin completed with no new findings. Node 22/24 CI passed on this head.

Previous-head Codecov patch coverage was 94.57%, with 39 uncovered lines. Those coverage checks passed. Worker bootstrap/exit paths and some error branches remain uncovered; no coverage exclusions were added. Hosted keep-alive testing and latency measurements remain pending.

Codex also ran the final local CLI against two real hosted iOS sessions with Expo Go SDK 58. Human and JSON startup imports, settings readback, file upload/readback, Unicode clipboard, screenshots, warm connection reuse, concurrent callers, idle expiry, close/drain/reopen, and failure handling passed. Both sessions were stopped and local helpers closed. The old Coin Flip build archive returned HTTP 403, so this run used Expo Go.

Authorship and LLM use

Gabe chose the connection commands and timeout, then asked to share the control code with imports. Codex implemented the helper, moved the action executor into this layer and restacked the imports. Gabe reviewed the changes at 1899090. Codex then rebased onto current main and later corrected shutdown-test races exposed by Node 22 CI. The existing poll delay now lets the close event abort the connection before checking refusal replies. The close-caller test also retries transient probe disconnects and still checks the close acknowledgement and active-work drain. Szymon approved the earlier base at 011dfd3. Gabe subsequently tried the CLI and approved the compact help examples. These stay in the command descriptions and use normal oclif formatting. Connection and action execution code is unchanged by this update.

Astra and Opus reviews led to removing redundant authentication and validation, then fixing admission and shutdown races. Devin identified the close/reopen race. Coverage reviews corrected a masked shutdown assertion and a fake-timer race. Independent rechecks were clean on the earlier combined implementation; Codex checked the reorganized layers and preserved feature tree. Those independent reviews and hosted testing were not repeated for the split.

Gabe asked to remove custom help formatting. Codex removed the simulator help classes and restored the original help registration. Shared help and control execution are unchanged from the previous implementation.

Gabe reviewed the final changes at a15cfbf after the help cleanup.

Codex then rebased onto main 21a1684 after the account-selection change landed. Range-diff confirms all three feature patches are unchanged. A third real hosted iOS session passed startup/import, file readback, screenshots and warm-connection checks on the rebased CLI, then was stopped. The earlier real-session tests also passed close/drain/reopen and failure handling.

— Codex

@gwdp

gwdp commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex rebased the unchanged feature patches onto main 21a1684. The rebased full stack passed 1,020 account/simulator/help tests, build, typecheck, scoped lint and formatting. Three real hosted iOS sessions covered both startup output modes, imports, file/clipboard readback, screenshots, warm connection reuse, idle expiry, close/drain/reopen, and failure handling; the third repeated the core flow after the rebase. All owned sessions are stopped and helpers closed. Gabe’s final feature review preceded this main-only rebase. Devin completed with no new findings. Node 22/24 CI passed.

Merged with one squash commit per PR. Main’s tree matches the live-tested rebased stack exactly. Post-merge CI is being checked separately.

— Codex

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.56825% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.94%. Comparing base (21a1684) to head (15d62ff).

Files with missing lines Patch % Lines
...s/eas-cli/src/simulator/controlConnectionWorker.ts 78.37% 36 Missing and 1 partial ⚠️
packages/eas-cli/src/simulator/hostActions.ts 96.08% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4791      +/-   ##
==========================================
+ Coverage   76.74%   76.94%   +0.21%     
==========================================
  Files        1109     1115       +6     
  Lines       55735    56364     +629     
  Branches    12323    12470     +147     
==========================================
+ Hits        42766    43364     +598     
- Misses      11980    12010      +30     
- Partials      989      990       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 7b3bbf9 to 04b5495 Compare October 30, 2026 01:15
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

devin-ai-integration[bot]

This comment was marked as outdated.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 04b5495 to 5261e34 Compare October 30, 2026 01:33
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 5261e34 to f2c3b5c Compare October 31, 2026 06:01
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from f2c3b5c to 0de7ec0 Compare October 31, 2026 06:34
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp changed the base branch from gwdp/start-import-second-20261018 to main November 3, 2026 04:27
@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 0de7ec0 to 1899090 Compare November 3, 2026 04:27
@gwdp
gwdp added this pull request to stack #4804 November 3, 2026 04:33
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

devin-ai-integration[bot]

This comment was marked as outdated.

@gwdp
gwdp marked this pull request as ready for review November 3, 2026 05:08
@gwdp
gwdp requested a review from szdziedzic November 3, 2026 05:08
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
packages/eas-cli/** @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

@linear-code

linear-code Bot commented Nov 3, 2026

Copy link
Copy Markdown

ENG-28817

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 1899090 to 011dfd3 Compare November 4, 2026 04:39
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 011dfd3 to ff2aea7 Compare November 4, 2026 05:19
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from ff2aea7 to ee19c5d Compare November 4, 2026 05:40
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from ee19c5d to 6d4815a Compare November 4, 2026 19:51
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from 6d4815a to b0790c0 Compare November 5, 2026 18:00
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from b0790c0 to a15cfbf Compare November 5, 2026 19:58
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/simulator-control-keep-alive branch from a15cfbf to 15d62ff Compare November 5, 2026 22:24
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

✅ Thank you for adding a changeset!

@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp merged commit ec9896a into main Nov 5, 2026
11 checks passed
@gwdp
gwdp deleted the gwdp/simulator-control-keep-alive branch November 5, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants